package com.bkhc.product.entity;

import com.bkhc.common.annotation.Uid;
import com.bkhc.common.enu.PartnershipEnum;
import com.bkhc.common.listener.DataEntityListener;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@Entity
@Data
@Table(name = "tbl_partner_t")
@EntityListeners({AuditingEntityListener.class, DataEntityListener.class})
public class Partner {
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private int id ;

    @Uid
    @Column(name = "partner_code")
    private String partnerCode;
    @NotNull
    @Column(name = "partner_name")
    private String partnerName;
    @NotNull
    @Column(name = "profile")
    private String profile;
    @NotNull
    @Column(name = "partnership")
    private PartnershipEnum partnership;
    @NotNull
    @Column(name = "file_id")
    private String businessLicense;
    @NotNull
    @Column(name = "log_file_id")
    private String partnerLog;
    @Column(name = "web_sit")
    private String websit;

    @Transient
    private List<String> brandCodes;
    @Transient
    private List<PartnerBrand> partnerBrands;
    @Transient
    private String manager;

    @Transient
    private String fullName;
    @Transient
    private String username;
    @Transient
    private String mobile;

    @Transient
    private Employee employee;
//    @NotNull
//    @Transient
//    private Brand brand;
//
//    @NotNull
//    @Transient
//    private List<Product> products;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;
}
